<div class="nav">
    <a class="sel" href="{:U('index')}">会员优惠券</a>
</div>
<div class="search">
    <form method="get" action="">
        会员名称：<input type="text" name="username" id="username" value="{$username}" style="width:80px;" class="input1" />&nbsp;
        备注：<input type="text" name="remark" id="remark" value="{$remark}" class="input1" style="width:80px;" />&nbsp;
        发放时间：<input type="text" name="time_begin" id="time_begin" value="{$time_begin}" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})" class="date" />
        - <input type="text" name="time_end" id="time_end" value="{$time_end}" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})" class="date" />
        &nbsp;
        是否使用：<select name="is_use" id="is_use" class="sel1">
            <option value="0">全部</option>
            <option value="1">已使用</option>
            <option value="2">未使用</option>
        </select>
        <input type="submit" class="btn_search" name="submit" value="搜索" />
        
        <input type="hidden" name="p" value="1" />
    </form>
</div>
<div class="list">
    <form method="post" id="frm_list" action="">
    <table class="table_list">
        <thead>
            <tr>
                <td width="60px">选择</td>
                <td width="240px">优惠券编号</td>
                <td>会员</td>
                <td>面额</td>
                <td>满多少使用</td>
                <td width="130px">开始时间</td>
                <td width="130px">结束时间</td>
                <td>备注</td>
                <td>是否使用</td>
                <td width="120px">创建时间</td>
                
            </tr>
        </thead>
        <tbody>
        <foreach name="list" item="list">
            <tr><td><input type="checkbox" name="selid[]" value="{$list.id}" /></td>
                <td style="text-align:left;">{$list.youhui_code}</td>
                <td>{$list.member_id|show_member_name}</td>
                <td>{$list.money}</td>
                <td>{$list.cart_total}</td>
                <td>{$list.begin_time|stringtoday=2}</td>
                <td>{$list.end_time|stringtoday=2}</td>
                <td>{$list.remark}</td>
                <td>{$list['is_use']==0?"未使用":"已使用"}</td>
                <td>{$list.create_time|strtotime|date='Y-m-d',###}</td>
            </tr>
        </foreach>
        </tbody>
        <tfoot>
            <tr><td colspan="11" style="text-align:left;">
                    <input name="checkall" id="checkall" type="checkbox" onclick="check_all(this.form)" value="1"><label for="checkall">全选</label>&nbsp;
                    <input type="button" class="btn_a2" onclick="del_sel()" value="删除所选" />
                </td></tr>
            <tr><td colspan="11"><div class="page">{$page}</div></td></tr>
        </tfoot>
    </table>
    </form>
</div>
 
<script type="text/javascript">
    //全选
    function check_all(form)
    {
        var elems = form.getElementsByTagName("input");
        for(var i=0;i<elems.length;i++)
        {
            if (elems[i].name == "selid[]")
            {
                elems[i].checked = form.checkall.checked;
            }
        }
    }
    //删除所选
    function del_sel() {
        if(confirm('确定删除所选吗？')) {
            $("#frm_list").attr('action','{:U('delsel')}');
            $("#frm_list").submit();
        }
    }
</script>
